import request from '@/utils/request'
import {download} from '@/utils/request'
import {getNowDate} from '@/utils/tools.js'


// 分页获取商家列表
export function getShopList(params) {
  return request({
    url: '/system/acddShop/list',
    method: 'get',
    params
  })
}

// 不分页获取商家列表
export function getShopListNoPage() {
  return request({
    url: '/system/acddShop/notPageList',
    method: 'get'
  })
}

// 获取商家列表
export function getShopCooperatelist(params) {
  return request({
    url: '/system/acddShop/shopCooperatelist',
    method: 'get',
    params
  })
}

// 获取未添加的商家列表
export function getShopNotCooperate(params) {
  return request({
    url: '/system/acddShop/shopNotCooperate',
    method: 'get',
    params
  })
}


// 新建商家
export function addShop(data) {
  return request({
    url: '/system/acddShop/add',
    method: 'POST',
    data
  })
}

// 修改商家
export function editShop(data) {
  return request({
    url: '/system/acddShop/edit',
    method: 'post',
    data
  })
}

// 根据ids查询商家
export function getShopByIds(params) {
  return request({
    url: `/system/acddShop/acddShopIds`,
    method: 'get',
    params
  })
}

// 商家查询(查看)
export function getShopDetail(id) {
  return request({
    url: `/system/acddShop/getInfo/${id}`,
    method: 'GET'
  })
}

// 暂停/开启合同
export function controlShop(data) {
  return request({
    url: `/system/acddShop/pause`,
    method: 'post',
    data
  })
}

// 随机密码
export function randomPassword() {
  return request({
    url: `/system/acddShop/randomPassword`,
    method: 'get'
  })
}

// 随机密码
export function exportData(filename) {
  return download('/system/acddShop/export', {}, `${filename}${getNowDate()}.xlsx`)
}